package com.tl.juc.c1;

public class CreateThread {
    public static void main(String[] args) throws InterruptedException {
        createRunnable();
        createThread();
    }
    public static void createRunnable() {
        // 匿名内部类
//        Thread t1 = new Thread(new Runnable() {
//            @Override
//            public void run() {
//                while (true) {
//                    System.out.println("线程Runnable");
//                }
//            }
//        });
        Thread t1 = new Thread(()->
        // run
        {
            System.out.println("线程Runnable");
        });
        t1.start();
    }

    public static void createThread() {
        // 匿名内部类
        Thread t2 = new Thread() {
            public void run () {
                System.out.println("线程Thread");
            }
        };
        t2.start();
    }
}
